import { useState } from 'react'
import { Cell } from 'react-vant'
export default ({ data, value, searchClick }) => {
    const reg = new RegExp(value, 'gi')
    if (data.length > 0) {
        return data.map((item, index) => {
            if (item) {
                const abc = item.replace(reg, `<span class="red">${value}</span>`)
                return (<Cell onClick={() => searchClick(item)} key={index}><div dangerouslySetInnerHTML={{ __html: abc }} /></Cell>)
            } return <div></div>
        })
    }
    return <div></div>
}